/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.eps.tesoreria.Entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.eps.entity.Localidad;
import com.eps.entity.Zona;

/**
 *
 * @author Luis_Angel
 */
@Entity
@Table(name = "comprobante_caja")
@NamedQueries({
    @NamedQuery(name = "ComprobanteCaja.findAll", query = "SELECT c FROM ComprobanteCaja c"),
    @NamedQuery(name = "ComprobanteCaja.findByIdComprobanteCaja", query = "SELECT c FROM ComprobanteCaja c WHERE c.idComprobanteCaja = :idComprobanteCaja"),
    @NamedQuery(name = "ComprobanteCaja.findByGlosa", query = "SELECT c FROM ComprobanteCaja c WHERE c.glosa = :glosa"),
    @NamedQuery(name = "ComprobanteCaja.findByFecha", query = "SELECT c FROM ComprobanteCaja c WHERE c.fecha = :fecha"),
    @NamedQuery(name = "ComprobanteCaja.findByAnio", query = "SELECT c FROM ComprobanteCaja c WHERE c.anio = :anio"),
    @NamedQuery(name = "ComprobanteCaja.findByMes", query = "SELECT c FROM ComprobanteCaja c WHERE c.mes = :mes"),
    @NamedQuery(name = "ComprobanteCaja.findByReferente", query = "SELECT c FROM ComprobanteCaja c WHERE c.referente = :referente")})
public class ComprobanteCaja implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_comprobante_caja")
    private String idComprobanteCaja;
    @Column(name = "glosa")
    private String glosa;
    @Column(name = "fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "anio")
    private String anio;
    @Column(name = "mes")
    private String mes;
    @Column(name = "referente")
    private String referente;
    @JoinColumn(name = "tipo_comprobante", referencedColumnName = "id_comprobante_caja")
    @ManyToOne
    private TipoComprobanteCaja tipoComprobante;
    @OneToMany( mappedBy = "comprobanteCaja")
    private List<DetalleComprobanteCaja> detalleComprobanteCajaList;
    @Column(name = "flag_cierre")
    private boolean flagCierre;
    @Column(name = "cuenta_contable")
    private String cuenta_contable;
    @Column(name = "importe")
    private BigDecimal importe;
    
    @JoinColumn(name = "id_comprobante_refer", referencedColumnName = "id_comprobante_caja")
    @ManyToOne
    private ComprobanteCaja idComprobanteRefer;
    @Column(name = "estado_comprobante")
    private Integer estado_comprobante;
    @Column(name = "codPlanillaBanco")
    private String codPlanillaBanco;
    

    public ComprobanteCaja() {
    }

    public ComprobanteCaja(String idComprobanteCaja) {
        this.idComprobanteCaja = idComprobanteCaja;
    }

	public ComprobanteCaja getIdComprobanteRefer() {
		return idComprobanteRefer;
	}

	public void setIdComprobanteRefer(ComprobanteCaja idComprobanteRefer) {
		this.idComprobanteRefer = idComprobanteRefer;
	}

	public Integer getEstado_comprobante() {
		return estado_comprobante;
	}

	public void setEstado_comprobante(Integer estadoComprobante) {
		estado_comprobante = estadoComprobante;
	}

	public String getCodPlanillaBanco() {
		return codPlanillaBanco;
	}

	public void setCodPlanillaBanco(String codPlanillaBanco) {
		this.codPlanillaBanco = codPlanillaBanco;
	}

	public boolean isFlagCierre() {
        return flagCierre;
    }

    public void setFlagCierre(boolean flagCierre) {
        this.flagCierre = flagCierre;
    }

    public String getIdComprobanteCaja() {
        return idComprobanteCaja;
    }

    public void setIdComprobanteCaja(String idComprobanteCaja) {
        this.idComprobanteCaja = idComprobanteCaja;
    }

    public String getGlosa() {
        return glosa;
    }

    public void setGlosa(String glosa) {
        this.glosa = glosa;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getAnio() {
        return anio;
    }

    public void setAnio(String anio) {
        this.anio = anio;
    }

    public String getMes() {
        return mes;
    }

    public void setMes(String mes) {
        this.mes = mes;
    }

    public String getReferente() {
        return referente;
    }

    public void setReferente(String referente) {
        this.referente = referente;
    }

    public TipoComprobanteCaja getTipoComprobante() {
        return tipoComprobante;
    }

    public void setTipoComprobante(TipoComprobanteCaja tipoComprobante) {
        this.tipoComprobante = tipoComprobante;
    }

    public List<DetalleComprobanteCaja> getDetalleComprobanteCajaList() {
        return detalleComprobanteCajaList;
    }

    public void setDetalleComprobanteCajaList(List<DetalleComprobanteCaja> detalleComprobanteCajaList) {
        this.detalleComprobanteCajaList = detalleComprobanteCajaList;
    }

    public String getCuenta_contable() {
        return cuenta_contable;
    }

    public void setCuenta_contable(String cuenta_contable) {
        this.cuenta_contable = cuenta_contable;
    }

    public BigDecimal getImporte() {
        return importe;
    }

    public void setImporte(BigDecimal importe) {
        this.importe = importe;
    }

   
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idComprobanteCaja != null ? idComprobanteCaja.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ComprobanteCaja)) {
            return false;
        }
        ComprobanteCaja other = (ComprobanteCaja) object;
        if ((this.idComprobanteCaja == null && other.idComprobanteCaja != null) || (this.idComprobanteCaja != null && !this.idComprobanteCaja.equals(other.idComprobanteCaja))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tesoreria.ejb30.entity.ComprobanteCaja[idComprobanteCaja=" + idComprobanteCaja + "]";
    }

}
